<template>
  <div class="hello">
    <button @click="buttonclick">按钮</button>
    <div v-for="(list,index) in showList" :key="index" v-if="show">
      <div>({{index}}).{{list}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  data() {
    return {
      msg: "Welcome to Your Vue.js App",
      showList:[],
      show:false,
    };
  },
  methods: {
    buttonclick() {
      var that=this;
      console.log(123);
      this.$http.get("/api/mock/11709/getdata").then(res => {
        if (res.data.static) {
          that.showList= res.data.data
          console.log(that.showList);
          that.show=true
        } else {
          console.log("请求失败");
          return false;
        }
      });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
